﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BitBox.Framework.KBR.DAL;
using BitBox.Framework.KBR.Model;


namespace BitBox.WinForm.BackOffice
{
    public partial class frmUsuario : Form
    {
        public frmUsuario()
        {
            InitializeComponent();
        }

        private void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                UserInfo usrinfo = new UserInfo();
                UserDAL usrDal = new UserDAL();

                if (txtConfPass.Text == txtPassword.Text && txtPassword.Text!="" && txtEmail.Text!="")
                {
                    usrinfo.USER_NAME = txtEmail.Text;
                    usrinfo.USER_PASSWORD = txtPassword.Text;

                    if (usrDal.Insert(usrinfo) > 0)
                    {
                        MessageBox.Show("Usuário Cadastrado com sucesso");
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Erro no cadastro");
                    }
                }
                else
                {
                    MessageBox.Show("Senhas não conferem");
                }
            }
            catch { MessageBox.Show("Erro no cadastro"); }
        }
    }
}
